<?php
    
	require_once( 'socialmedia-option.php' ); 
	
	
	$items = get_theme_support( 'cvincludes-socialmedia' );
	if(isset($items[0])) {
		if ( in_array( 'twitter', $items[0] ) && !is_admin()) 
			add_action('wp_print_scripts', 'cv_socialmedia_javascript' );			
	}		
		
	function cv_socialmedia_javascript() {			
		$data = cv_get_option();
		
		if ( $data['sm_twitter_url'] != '') {	
			wp_enqueue_script( 'socialmedia-twitter', trailingslashit(CVINCLUDES_SOCIALMEDIA_URI) . 'js/twitter.min.js');
			wp_localize_script( 'socialmedia-twitter', 'cvtwittersettings',			
					array(				
						'cvsmtwitteruser'      => basename($data['sm_twitter_url']),
						'cvsmtwitterlimit'   => $data['sm_twitter_limit']
						)
				);
		}
	}
	
	function cv_twitter() {
		echo '<div id="cv-twitter"><p>'. __('Latest tweets:', hybrid_get_textdomain()) . '</p></div>';	
	}

?>
